<!DOCTYPE html>
<html>
<head>
	<include file="Public:common-css" />
	<link type="text/css" rel="stylesheet" href="__ICSS__/member.css" />
	<link href="__ICSS__/validform/validform.css" rel="stylesheet">
</head>
<body>
<div class="container">
<!-------------------------header--------------------------------->
<include file="Public:header" />
<!--------------------------content------------------------------->
	<div class="clr"></div>
    <div class="content">
    	<include file="Public:member-left" />
        <div class="member-right">
        	<div class="member-breadcrumbs">
            	<a href="__ROOT__">首页</a>
                &gt;
                <span>个人中心</span>
                &gt;
                <span>密码修改</span>
            </div>
            <div class="clr"></div>
          	<div class="m-box">
            	<div class="member-content">
					<div class="member-modifyphone-box">
						<div class="member-modifyphone-message">豪斯先生提醒你： 为保障账号安全，请先对你的身份进行验证!</div>
						<form action="__ROOT__/User/editTel" method="post" class="form">
							<div class="member-form-item">
								<em>原手机</em>
								<div class="member-item">
									<input type="text" name="oldTel" datatype="m" class="member-form-input" placeholder="请输入原手机号码" nullmsg="请填写原手机号码" errormsg="请填写正确的手机号码" sucmsg="输入正确"/>
									<span class="Validform_checktip"></span>
								</div>
							</div>
							<div class="member-form-item">
								<em>新手机</em>
								<div class="member-item">
									<input type="text" name="newTel" datatype="m" class="member-form-input" placeholder="请输入新手机号码"  nullmsg="请填写新的手机号码" sucmsg="可以使用！" name="tel" errormsg="输入错误！"/>
									<span class="Validform_checktip"></span>
								</div>
							</div>
							<div class="member-form-item">
								<em>验证码</em>
								<div class="member-item">
									<input type="text" class="member-form-input phone-code-input" id="tel_code" placeholder="验证码" name="phoneCode" datatype="s6-6" nullmsg="请输入手机验证码" sucmsg="输入正确！" errormsg="输入错误！"/>
									<input type="button" id="phone-btn" class="phone-code-button" value="获取手机验证码"/><em id="em_code" class="em-code-success"></em>
									<span class="Validform_checktip"></span>
								</div>
							</div>
							<div class="member-form-item">
								<em></em>
								<div class="member-item">
									<input type="submit" class="member-form-submit" value="确认修改"/>
									<button type="reset" id="reset2" class="hide btn btn-success btn-block">重置</button>
								</div>
							</div>
						</form>
					</div>
				</div>
            </div>
        </div>
    </div>
    <div class="clr"></div>
<!--------------------------content-end--------------------------->
    <include file="Public:footer" />
</div>

</body>
<include file="Public:common-js" />
<script src="__IJS__/Validform_v5.3.2_min.js"></script>
<script type="text/javascript">
$(function(){
	$(".register-btn").click(function (){
		if(!testSpace($(".phonenum").val())){
			layer.msg("手机号码中含有空格字符，请重新检查");
			$('input[name="tel"]').focus();
			return false;
		}
		function testSpace(str){
			if(str.indexOf(" ") >= 0){
				return false;
			}else{
				return true;
			}
		}
	})
	$("#reset2").click();
	//表单验证
	var form=$(".form").Validform({
		btnSubmit:".register-btn", 
		tiptype:4,
		label:".label",
		showAllError:false,
		postonce:true,
		datatype:{
			"p6-20":/^[a-z0-9A-Z]{6,20}$/
			
		},
		ajaxPost:true,
		callback:function(data){
			if(data.status == 1){
				layer.alert(data.info);
				window.location.reload();
			}else{
				layer.alert(data.info);
			}
		}
	});
	form.tipmsg.w["p6-20"]="密码格式为6到20位英文数字！";
	form.addRule([{
		ele:".phonenum",
		datatype:"m"
	},
	{
		ele:".phone-code-input",
		datatype:"s6-6"	
	},
	{
		ele:".password1",
		datatype:"p6-20"
	},
	{
		ele:".password2",
		datatype:"p6-20",
		recheck:"password"
	}]);
	$("#reflesh").click(function(){
		fleshVerify();
	})
	
		
	//发送成功请等待 
	$("#phone-btn").click(function() {
		var telIpt = $('input[name="newTel"]');
		//判断手机是否验证通过
		$.ajax({
			url:"__ROOT__/Login/sendPhoneCode",
			type:"post",
			data:{tel:telIpt.val()},
			success:function(data){
				if(data.status == 1){
					$("#em_code").attr("class","em-code-error");
					$("#em_code").html(data.info);
				}else{
					$("#em_code").attr("class","em-code-success");
					$("#em_code").html("");
				}
			}
		})
		countDown(this);
	});

})
//倒计时
var wait= 60;
function countDown(t){
	if (wait == 0) {
		$("#phone-btn").attr("class","phone-code-button");
		t.removeAttribute("disabled");			
		t.value="获取手机验证码";
		wait = 60;
	} else {
		t.setAttribute("disabled", true);
		$("#phone-btn").attr("class","phone-code-button-off");
		t.value="重新发送(" + wait + ")";
		wait--;
		setTimeout(function() {
			countDown(t)
		},1000)
	}
}
</script>
</html>
